<?php

namespace app\adminapi\validate;

use app\common\validate\BaseValidate;

class SysRoleValidate extends BaseValidate
{
    protected $rule = [
        'pageNo' => 'regex:/^([1-9]\d*)$/',
        'pageSize' => ['regex'=>'/^(-1|[1-9]\d*)$/'],
        'timeArr' => 'array',
        'roleId' => 'require|number',
        'id' => 'require|number',
        'roleCode' => 'require',
        'roleName' => 'require',
        'status' => 'number'
    ];

    protected $message = [
        'pageNo.number' => '分页页码只能是数字',
        'pageSize.number' => '分页页大小只能是数字',
        'timeArr.array' => '时间数组格式错误',
        'id.require' => '角色参数不完整',
        'roleId.number' => '角色ID类型错误',
        'roleCode.require' => '请输入角色编码',
        'roleName.require' => '请输入角色名称',
        'status.require' => '状态参数值错误'
    ];

    protected $scene = [
        'list' => ['pageNo', 'pageSize', 'timeArr', 'status'],
        'insert' => ['roleCode', 'roleName'],
        'delete' => ['roleId'],
        'query' => ['roleId'],
        'update' => ['id', 'roleCode', 'roleName']
    ];
}